Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Imports DotNetNuke.Modules.ProjectTracker.Business

Namespace DotNetNuke.Modules.ProjectTracker

    Public MustInherit Class Settings
        Inherits DotNetNuke.Entities.Modules.ModuleSettingsBase

#Region "Controls"
        Protected WithEvents fldDescription As TextBox
        Protected WithEvents cbxColorCodeGrid As System.Web.UI.WebControls.CheckBox
        Protected WithEvents cbxLastActivityOnGrid As System.Web.UI.WebControls.CheckBox
#End Region

        Public Overrides Sub LoadSettings()
            Try
                If Not Page.IsPostBack Then
                    ' Load settings from TabModuleSettings: specific to this instance
                    fldDescription.Text = CType(Settings("description"), String)
                    cbxColorCodeGrid.Checked = CType(Settings("ColorCodeGrid"), Boolean)
                    cbxLastActivityOnGrid.Checked = CType(Settings("LastActivityOnGrid"), Boolean)
                End If
            Catch exc As Exception
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        Public Overrides Sub UpdateSettings()
            Try
                Dim objModules As New Entities.Modules.ModuleController

                ' Update TabModuleSettings
                objModules.UpdateModuleSetting(ModuleId, "description", fldDescription.Text)
                objModules.UpdateModuleSetting(ModuleId, "ColorCodeGrid", cbxColorCodeGrid.Checked.ToString())
                objModules.UpdateModuleSetting(ModuleId, "LastActivityOnGrid", cbxLastActivityOnGrid.Checked.ToString())

                ' Redirect back to the portal home page
                Response.Redirect(NavigateURL(), True)
            Catch exc As Exception
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

#Region " Web Form Designer Generated Code "

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        End Sub

        'NOTE: The following placeholder declaration is required by the Web Form Designer.
        'Do not delete or move it.
        Private designerPlaceholderDeclaration As System.Object

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
        End Sub

#End Region

    End Class

End Namespace
